package com.study.bean;


import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.*;
import java.time.LocalDateTime;

/**
 * @author zhuzi
 * 2023/8/11 10:07
 */
@Data
public class UserInfo {
    //新增组
    public interface Add {

    }

    public interface Update {

    }

    @Null(groups = Add.class)//只适用于新增
    @NotNull(groups = Update.class)//只适用于修改
    private Long id;
    @NotBlank
    private String name;

    @NotNull
    @Valid//被引用的对象加上这个才能级联校验
    private Grade grade;
    @NotNull
    //@Min(1) @Max(777) //只有不等于Null才生效
    //@Range(min = 1, max = 777)//闭区间
    @Min(value = 18, message = "年龄小于{value}")
    private Integer age;

    @NotBlank
    @Email
    private String email;

    private String phone;

    @Past
    private LocalDateTime birthDay;


}
